import http from "@/utils/http";
import {EnumAlias} from "@/utils/common";

export function rolePage(params?: object) {
  return http({
    url: `/${EnumAlias.PROJECT}/${EnumAlias.MODULE_SYS}/role/page`,
    method: "get",
    params
  });
}

export function roleDetail(params?: object) {
  return http({
    url: `/${EnumAlias.PROJECT}/${EnumAlias.MODULE_SYS}/role/detail`,
    method: "get",
    params
  });
}

export function roleDelete(data?: object) {
  return http({
    url: `/${EnumAlias.PROJECT}/${EnumAlias.MODULE_SYS}/role/delete`,
    method: "post",
    data
  });
}

export function roleAdd(data?: object) {
  return http({
    url: `/${EnumAlias.PROJECT}/${EnumAlias.MODULE_SYS}/role/add`,
    method: "post",
    data
  });
}

export function roleEdit(data?: object) {
  return http({
    url: `/${EnumAlias.PROJECT}/${EnumAlias.MODULE_SYS}/role/edit`,
    method: "post",
    data
  });
}

export function menuTree(params?: object) {
  return http({
    url: `/${EnumAlias.PROJECT}/${EnumAlias.MODULE_SYS}/menu/tree`,
    method: "get",
    params
  });
}

export function roleOwnMenu(params?: object) {
  return http({
    url: `/${EnumAlias.PROJECT}/${EnumAlias.MODULE_SYS}/role/ownMenu`,
    method: "get",
    params
  });
}

export function roleGrantMenu(data?: object) {
  return http({
    url: `/${EnumAlias.PROJECT}/${EnumAlias.MODULE_SYS}/role/grantMenu`,
    method: "post",
    data
  });
}

export function roleGrantData(data?: object) {
  return http({
    url: `/${EnumAlias.PROJECT}/${EnumAlias.MODULE_SYS}/role/grantData`,
    method: "post",
    data
  });
}
